﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<h2>Members</h2>

    <%
        if (Session["login"] == null || (bool)Session["login"] == false)
        {
            using (Html.BeginForm("LogOn", "Account"))
            {
                %>
               
                <div>
                    <fieldset>
                        <legend>Account Information</legend>
                        <p>
                            <label for="userid">Username:</label>
                            <%=Html.TextBox("userid")%>
                        </p>
                        <p>
                            <label for="pass">Password:</label>
                            <%=Html.Password("pass")%>
                        </p>
                        <br />
                        <p>
                            <%: Html.CheckBox("remember") %>
                            Remember me
                        </p>
                        <% if (Session["login"] != null)
                               Response.Write("<b style='color:Red;'>Login was unsuccessful. Please correct the errors and try again.</b>");%>
                        <br />
                        <p>
                            <%= Html.ActionLink("Register", "Register", "Account")%> if you don't have an account.
                        </p>
                        <br />
                        <p>
                            <input type="submit" id="submit_btn" value="Sign In" />
                        </p>
                    </fieldset>
                </div>
    <%      }
            Session["login"] = null;
        }
        else
        {
            GIFT_SHOP_MVC.Models.User user = (GIFT_SHOP_MVC.Models.User)Session["user"];
            using (Html.BeginForm("LogOff", "Account"))
            { 
            %>
             <div>
                <fieldset>
                    <legend>Account Information</legend>
                    <p style="text-align:center;"><marquee behavior="scroll"><%Response.Write(user.HoTen); %></marquee></p>
                    <p style="text-align:center;"><a href="../../Account/Profile">Profile</a></p>
                    <p style="text-align:center;"><a href="../../Account/ChangePassword">Change Password</a></p>
                    <% if (user.Admin == false)
                       { %>
                    <p style="text-align:center;"><a href="../../Product/ProductBought">Products Bought</a></p>
                    <%}
                       else
                       { %>
                       <p style="text-align:center;"><a href="../../Admin">Admin Page</a></p>
                    <%} %>
                    <br />
                    <p>
                        <input type="submit" value="Sign Out" id="submit_btn" />
                    </p>
                </fieldset>
            </div>
      <%    }
        } %>
